import request from '@/utils/request.js'

// 封装 获取分类的请求
export const getCategoryAPI = () => {
  return request.get('/my/cate/list')
}

// 封装添加分类的请求
export const addCategoryAPI = data => {
  return request.post('/my/cate/add', data)
}

// 删除分类的请求
export const delCategoryAPI = id => {
  /**
   * requset.get(url,配置对象)
   * requset.delete(url,配置对象)
   *
   * requset.post(url,请求体,配置对象)
   * requset.put(url,请求体,配置对象)
   * requset.patch(url,请求体,配置对象)
   *
   */
  return request.delete('/my/cate/del', { params: { id: id } })
  // 键值对相同,可只写一个
}
// 要实在不会写,就写万能的如下

// 封装添加分类的请求
export const updataCategoryAPI = data => {
  return request.put('/my/cate/info', data)
}
